package com.cgy.utils.jmx.constant;

import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author CHTK
 */
@Getter
@Setter
public class JvmInfo<T> {

    private Map<String, String> storesDescribe = new HashMap<>();
    private Map<String, T> storesValue = new HashMap<>();

    private List<Jvm> jvmList = new ArrayList<>();

    public JvmInfo put(String key, T value, String describe) {
        storesDescribe.put(key, describe);
        storesValue.put(key, value);

        Jvm<T> jvm = new Jvm();
        jvm.setDescribe(describe);
        jvm.setKey(key);
        jvm.setValue(value);

        jvmList.add(jvm);
        return this;
    }

    public void clear() {
        storesValue.clear();
        storesDescribe.clear();
        jvmList.clear();
    }
 }
